<?php
define('MAIN_HOST_URL', 'ghostly.my');
define('SHORT_HOST_URL', 'gh.my');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'Online Media Library',
	'sourceLanguage'=>'en',
    'language'=>'ru',
	'theme'=>'desktop',

	'preload'=>array('log', 'settings', 'booster'),

	'import'=>array(
		'application.models.*',
		'application.components.*',
	),

	'modules'=>array(
		// uncomment the following to enable the Gii tool
		
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'test',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		
	),

	'components'=>array(
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		'coreMessages'=>array( 'basePath'=>null, ),
		'booster' => array( 'class' => 'ext.booster.components.Booster' ),
		'settings' => array( 'class' => 'application.components.SettingsManager' ),
		/*
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=testdrive',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
		),
		*/
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
		'urlManager'=>array(
			'urlFormat'=>'path',
			'showScriptName'=>false,
			'rules'=>array(
				'http://<w:(\w+.|)>'.SHORT_HOST_URL.'/<shorturl>'=>'Site/fastRedirect',
				'/login' => 'Site/login',
				'/logout' => 'Site/logout',
				'http://music.'.MAIN_HOST_URL.'/'=>'MusicLibrary/index',		
				'http://music.'.MAIN_HOST_URL.'/song/<songid:(\w+)>'=>Array('MusicLibrary/infoSong'),
				'http://music.'.MAIN_HOST_URL.'/song/<songid:(\w+(?!mp3))>'=>Array('MusicLibrary/getSong', 'urlSuffix'=>'.mp3'),
				'http://music.'.MAIN_HOST_URL.'/song/<songid:(\w+)>/<act>'=>Array('MusicLibrary/<act>Song'),				
				'http://music.'.MAIN_HOST_URL.'/pl/<playlistid:(\w+)>'=>Array('MusicLibrary/playPlaylist'),				
				'http://music.'.MAIN_HOST_URL.'/pl/<playlistid:(\w+(?!m3u))>'=>Array('MusicLibrary/m3uPlaylist', 'urlSuffix'=>'.m3u'),
				'http://music.'.MAIN_HOST_URL.'/pl/<playlistid:(\w+)>/<act>'=>Array('MusicLibrary/<act>Playlist'),
				'/'	=>	'Site/index',
				'/<view:\w+(?!html)>' => Array('Site/page','urlSuffix'=>'.html'),
				'/<c>/<a>'	=>	'<c>/<a>',
						
				//'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				//'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'info@ghostly.ru',
		'errorView'=>'//site/error',
	),
);